package gate

import (
	"config"
	"game"
	"github.com/name5566/leaf/gate"
)

var (
	Instance = new(Module)
)

// 继承自Gate 负责消息分发
type Module struct {
	*gate.Gate
}

func (m *Module) OnInit() {
	// 初始化网关
	m.Gate = &gate.Gate{
		MaxConnNum:      config.Server.MaxConnNum,
		PendingWriteNum: config.PENDING_WRITE_NUM,
		MaxMsgLen:       config.MAX_MSG_LEN,
		WSAddr:          config.Server.WSAddr,
		HTTPTimeout:     config.HTTP_TIMEOUT,
		TCPAddr:         config.Server.TCPAddr,
		LenMsgLen:       config.LEN_MSG_LEN,
		LittleEndian:    config.LITTLE_ENDIAN,
		Processor:       processor, // 消息处理器
		AgentChanRPC:    game.Instance.ChanRPCServer,
	}
}
